package org.obm.lmtp.impl;

import org.obm.lmtp.Activator;
import org.obm.mina.ServiceException;

public class LmtpConfig {
	private String mRecipientDelimiter;
	private String name;
	private ILmtpBackend backend;

	public LmtpConfig() throws ServiceException {
		setName(getServerName());
		setRecipientDelimiter("+");
		setLmtpBackend(Activator.getDefault().getBackend());
		validate();
	}

	public void validate() throws ServiceException {
		if (getLmtpBackend() == null) {
			throw new ServiceException("missing lmtp backend");
		}
	}

	public static String getServerName() {
		return "";
	}

	public static String getServerVersion() {
		String version = "1.0.0-RC";
		return version;
	}

	public String getRecipientDelimiter() {
		return mRecipientDelimiter;
	}

	public void setRecipientDelimiter(String delimiter) {
		mRecipientDelimiter = delimiter;
	}

	public ILmtpBackend getLmtpBackend() {
		return backend;
	}

	public void setLmtpBackend(ILmtpBackend backend) {
		this.backend = backend;
	}

	public boolean permanentFailureWhenOverQuota() {
		return false;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

}
